package com.sneakxy.cloudbase.platform.repository;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import com.sneakxy.cloudbase.platform.bean.RolePerm;
import com.sneakxy.cloudbase.platform.bean.RolePermId;

/**
 * 
 * @author 潜行的青衣
 * @see
 */
@Repository
public interface RolePermRepository extends BaseRepository<RolePerm, RolePermId> {

	public List<String> findPermissions(@Param("roles") List<String> roles);
	
	@ResultType(String.class)
	@Select("select perm_id from t_mb4j_role_perm where role_id=#{roleId}")
	public List<String> findByRoleId(@Param("roleId") String roleId);
	
	@Delete("delete from t_mb4j_role_perm where perm_id=#{permId}")
	public int deleteByPermId(@Param("permId") String permId);
	
	@Delete("delete from t_mb4j_role_perm where role_id=#{roleId}")
	public int deleteByRoleId(@Param("roleId") String roleId);
	
}
